using System;
using System.ComponentModel;

namespace EventBroker
{
	/// <summary>
	/// Declares a method as an eventTopic_p subscription.
	/// </summary>
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
	public class CEventSubscriptionAttribute : Attribute
	{
		private string m_strTopic;
        private string m_strWorkItemGroupName;
        private EThreadOption m_eThreadOption;
        
        public CEventSubscriptionAttribute(string strTopic_p)
            : this(strTopic_p, EThreadOption.Publisher, null)
        {

        }

        public CEventSubscriptionAttribute(string strTopic_p, EThreadOption eThreadOption_p, string strWorkItemGroupName_p)
		{
			this.m_strTopic = strTopic_p;
            this.m_eThreadOption = eThreadOption_p;
            this.m_strWorkItemGroupName = strWorkItemGroupName_p;
		}

		/// <summary>
		/// The m_strName of the eventTopic_p the decorated method is subscribed to.
		/// </summary>
		public string Topic
		{
			get { return m_strTopic; }
		} 
       
        /// <summary>
		/// Indicates the way the subscription method should be called, see
		/// EThreadOption enumeration for the supported modes.
		/// </summary>
        [DefaultValue(EThreadOption.Publisher)]
		public EThreadOption Thread
		{
			set { m_eThreadOption = value; }
			get { return m_eThreadOption; }
		}

        [DefaultValue(null)]
        public string WorkItemGroupName
        {
            set { m_strWorkItemGroupName = value; }
            get { return m_strWorkItemGroupName; }
        }
	}
}